/*
 * @Author       : NaN 353362604@qq.com
 * @Date         : 2023-06-07 14:33:40
 * @LastEditTime : 2023-06-07 14:36:13
 * @LastEditors  : NaN 353362604@qq.com
 * @FilePath     : \AdminStration\src\Common\Router\MenuNav\TwoRouter\PersonGroup.jsx
 * @Description  :
 */
import { API_LIST } from '../../../Api/Api'
import { DelDataButton, OpenThrTouter } from '../Common/options'

export const PersonGroup = async ({ OptionsEvent, oneData, Permission, actionRef, ClientData }) => {
    let dataList = {
        type: '人员分组明细',
        hideInSearch: true,
        pageSize: 10,
        params: { personGroupUuid: oneData.uuid },
        classification: 'TableModal',
        get: API_LIST()['getPersonGroupDetail'],
        options: [
            Permission.findIndex(v => v.uuid === '78683476-4565-4906-a9de-8c2a17d78e51') !== -1 && (
                <OpenThrTouter
                    title="添加人员"
                    type="primary"
                    icon="add"
                    modal="SelectModal"
                    OptionsEvent={OptionsEvent}
                    other={{
                        page: 'PersonGroup',
                        actionRef,
                        Permission,
                        twoData: oneData,
                    }}
                />
            ),
        ],
        columns: [
            {
                dataIndex: 'tableName',
                title: '人员姓名',
                valueType: 'input',
            },
            {
                dataIndex: 'personTypeName',
                title: '人员类别',
                valueType: 'input',
            },
            {
                title: '操作',
                valueType: 'systemOperation',
                fixed: 'right',
                width: 300,
                hideInSearch: true,
                hideInAdded: true,
                hideInModify: true,
                render: (_, record) => {
                    const { uuid } = record
                    return [
                        Permission.findIndex(v => v.uuid === 'd46a8ee4-4555-40eb-b0f6-ead0b8096c95') !== -1 && (
                            <DelDataButton
                                OptionsEvent={OptionsEvent}
                                key="del"
                                title="删除"
                                url="PersonGroupDetail"
                                uuid={uuid}
                            />
                        ),
                    ]
                },
            },
        ],
    }
    return dataList
}
